home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1668 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.8 KB

  1. Path: news.mindspring.com!usenet
  2. From: wdnick@mindspring.com (William D. Nicholson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Newbie Question about fprintf
  5. Date: Fri, 12 Jan 1996 07:32:50 GMT
  6. Organization: SCT
  7. Message-ID: <4d4o9k$6m9@brickbat.mindspring.com>
  8. Reply-To: wdnick@mindspring.com
  9. NNTP-Posting-Host: wdnick.mindspring.com
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. OK.  I'm taking an Intro to C class at college and I've ran into a
  13. stumper.  At school we have a dot amtrix printer, I'm not sure what
  14. brand.  And I'm using an HP DeskJet Plus at home.  Also, at school we
  15. have Borland C++ 3.1 and I have 3.0.  The following lines work fine at
  16. school, but at home....
  17.  
  18.     printf ("\nEnter length> ");
  19.     fprintf (stdprn,"\nEnter length> ");
  20.     scanf ("%lf", &length);
  21.     printf ("Enter width> ");
  22.     fprintf (stdprn,"\nEnter width> ");
  23.     scanf ("%lf", &width);
  24.     area = length * width;
  25.     perim = (2 * length) + (2 * width);
  26.     printf ("\nThe area is %f\n", area);
  27.     fprintf (stdprn,"\nThe area is %f", area);
  28.     printf ("The perimeter is %f\n\n", perim);
  29.     fprintf (stdprn,"\nThe perimeter is %f\n", perim);
  30.  
  31. At home, the output to the printer looks something like this...
  32.  
  33. Enter length>  
  34.                           Enter width>
  35.                                                   The area is x.xxxxx
  36.  
  37. ...
  38.  
  39. Is this a problem between the 3.0 and 3.1 compiler, or a problem with
  40. my printer?  And either way, how can I fix it?   The \n in the fprintf
  41. lines is moving to a new line like it should, but not the beginning.
  42.  
  43.  
  44. Thanks for any help...
  45.  
  46.  
  47. William D. Nicholson                                       wdnick@mindspring.com 
  48. Mechanical Engineering Student       
  49. Southern College of Technology                           It is what you make it.
  50. Under heavy construction:  http://www.mindspring.com/~wdnick/home.html
  51.  
  52.